#include<iostream>
#include<string>
using std::endl;
using std::cout;
using std::string;
//继承
class Animal{
public:
    Animal(const char*name = nullptr ,const int &hp = 0)
    :_name(name)
    ,_hp(hp){
        cout<<"Animal(const string &name,const int &hp) "<<endl;
    }
    ~Animal(){
        cout<<"~Animal"<<endl;
    }
    void print(){
        cout<<"name :"<<_name<<endl;
        cout<<"hp: "<<_hp<<endl;
    }
    int test = 133;
protected:
    string _name;
    int _hp;
    
};

//具体动物 cat
class Cat
:public Animal{

public:
    Cat(const char* name,const int &hp,const string &action)
    :Animal(name,hp)
    ,_action(action)
    {}
    void print(){
        cout<<"name: "<<_name<<endl;
        cout<<"hp: "<<_hp<<endl;
        cout<<"action: "<<_action<<endl;
    }
    ~Cat(){
        cout<<"~cat"<<endl;
    }
    //int test = 11;
private:
    string _action; //动物行为
};

int main(void){
    Cat cat("mimi",13,"tree");
    cout<<endl;
    cat.print();
    cout<<endl;
    cat.Animal::print();
    Animal A("xixi");
    cout<<endl;
    cout<<A.test<<endl;
    //cout<<cat.test<<endl;
}